package com.woniu.service.medicalService.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.service.medicalService.IDictionaryMSService;
import com.woniu.mapper.medicalService.DictionaryMSMapper;
import com.woniu.model.gh.common.enums.RedisConstant;
import com.woniu.model.medicalService.entity.DictionaryMS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

//数据字典表
@Service
public class DictionaryMSServiceImpl extends ServiceImpl<DictionaryMSMapper, DictionaryMS> implements IDictionaryMSService {

    @Autowired
    private RedisTemplate redisTemplate;

    //初始化数据字典
    @Override
    public void initDictionary() {
        List<DictionaryMS> list = list();
        if (redisTemplate.hasKey(RedisConstant.DICTIONARY_LIST)) redisTemplate.delete(RedisConstant.DICTIONARY_LIST);
        redisTemplate.opsForList().rightPushAll(RedisConstant.DICTIONARY_LIST,list);
    }

}
